var util = require('../../utils/util.js')
var app = getApp()
let jinbiShareLgImg = ''
let jinbiShareMinImg = ''
let jinbiShareText = ''


Page({
  inputValue: '',
  data: {
    posterSrc: null,
    imgSrc: null,
    videoSrc: null
  },
  onLoad() {

    // 加载顶部多媒体展示到页面
    this.selectTopImg()
  },
  // 加载顶部多媒体展示到页面
  selectTopImg() {
    if (!app.globalData.getGlobalShareMedia) {
      jinbiShareLgImg = app.globalData.getGlobalShareMedia.jinbiShareLgImg
      jinbiShareMinImg = app.globalData.getGlobalShareMedia.jinbiShareMinImg
      jinbiShareText = app.globalData.getGlobalShareMedia.jinbiShareText
    } else {
      app.getGlobalShareMedia().then(res => {
        jinbiShareLgImg = res.jinbiShareLgImg
        jinbiShareMinImg = res.jinbiShareMinImg
        jinbiShareText = res.jinbiShareText
        this.setData({
          posterSrc: res.posterSrc,
          imgSrc: res.img,
          videoSrc: res.video
        })
      })
    }

  },
  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 用户点击右上角分享
   */
  //   let jinbiShareLgImg = ''
  // let jinbiShareMinImg = ''
  // let jinbiShareText = ''
  onShareAppMessage(e) {
    return {
      title: jinbiShareText,
      imageUrl: jinbiShareLgImg,
      path: `/pages/jinbi/jinbi`
    }
  },
  onShareTimeline(e) {
    return {
      title: jinbiShareText,
      imageUrl: jinbiShareMinImg,
    }
  },
})